package com.sairobo.admin.modules.srblive.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sairobo.base.modules.sys.controller.AbstractController;
import com.sairobo.base.common.entity.Page;
import com.sairobo.base.common.entity.R;
import com.sairobo.base.common.annotation.SysLog;

import com.sairobo.admin.modules.srblive.entity.SrbliveClassroom;
import com.sairobo.admin.modules.srblive.service.SrbliveClassroomService;

/**
 * 课题
 *
 * @author admin
 * @email sairobo
 * @url www.sairobo.com
 * @date 2018年1月11日 上午11:01:21
 */
@RestController
@RequestMapping("/srblive/classroom")
public class SrbliveClassroomController extends AbstractController {
	
	@Autowired
	private SrbliveClassroomService srbliveClassroomService;
	
	/**
	 * 列表
	 * @param params
	 * @return
	 */
	@RequestMapping("/list")
	public Page<SrbliveClassroom> list(@RequestBody Map<String, Object> params) {
		return srbliveClassroomService.listSrbliveClassroom(params);
	}
		
	/**
	 * 新增
	 * @param srbliveClassroom
	 * @return
	 */
	@SysLog("新增课题")
	@RequestMapping("/save")
	public R save(@RequestBody SrbliveClassroom srbliveClassroom) {
		return srbliveClassroomService.saveSrbliveClassroom(srbliveClassroom);
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@RequestMapping("/info")
	public R getById(@RequestBody Long id) {
		return srbliveClassroomService.getSrbliveClassroomById(id);
	}
	
	/**
	 * 修改
	 * @param srbliveClassroom
	 * @return
	 */
	@SysLog("修改课题")
	@RequestMapping("/update")
	public R update(@RequestBody SrbliveClassroom srbliveClassroom) {
		return srbliveClassroomService.updateSrbliveClassroom(srbliveClassroom);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除课题")
	@RequestMapping("/remove")
	public R batchRemove(@RequestBody Long[] id) {
		return srbliveClassroomService.batchRemove(id);
	}

    /**
     * 上下架
     * @param id
     * @return
     */
    @SysLog("上下架")
    @RequestMapping("/active")
    public R active(Long id,Integer active) {
        return srbliveClassroomService.active(id,active);
    }


    /**
     * 结束直播
     * @param id
     * @return
     */
    @SysLog("结束直播")
    @RequestMapping("/end")
    public R end(Long id) {
        return srbliveClassroomService.end(id);
    }
	
}
